package com.ruoyi.develop.orderIronRecord.controller;

import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.develop.orderIronRecord.domain.OrderIronRecord;
import com.ruoyi.develop.orderIronRecord.service.IOrderIronRecordService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 铁附件订单拆解记录Controller
 * @author lmm
 * @date 2024-10-21
 */
@RestController
@RequestMapping("/orderIronRecord/orderIronRecord")
public class OrderIronRecordController extends BaseController {
    @Autowired
    private IOrderIronRecordService orderIronRecordService;

    /**
     * 查询铁附件订单拆解记录列表
     */
    @PreAuthorize("@ss.hasPermi('develop:OrderIronRecord:query')")
    @GetMapping("/list")
    public TableDataInfo list(OrderIronRecord entity) {
        startPage();
        List<OrderIronRecord> list = orderIronRecordService.selectList(entity);
        return getDataTable(list);
    }

    @PreAuthorize("@ss.hasPermi('develop:OrderIronRecord:query')")
    @GetMapping("/listBuyRemain")
    public TableDataInfo listBuyRemain(OrderIronRecord entity) {
        startPage();
        List<OrderIronRecord> list = orderIronRecordService.selectListBuyRemain(entity);
        return getDataTable(list);
    }


    /**
     * 导出铁附件订单拆解记录列表
     */
    @PreAuthorize("@ss.hasPermi('develop:OrderIronRecord:export')")
    @Log(title = "铁附件订单拆解记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, OrderIronRecord entity) {
        List<OrderIronRecord> list = orderIronRecordService.selectList(entity);
        ExcelUtil<OrderIronRecord> util = new ExcelUtil<OrderIronRecord>(OrderIronRecord. class);
        util.exportExcel(response, list, "铁附件订单拆解记录数据");
    }

    /**
     * 获取铁附件订单拆解记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('develop:OrderIronRecord:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id) {
        return AjaxResult.success(orderIronRecordService.selectById(id));
    }

    /**
     * 新增铁附件订单拆解记录
     */
    @PreAuthorize("@ss.hasPermi('develop:OrderIronRecord:add')")
    @Log(title = "铁附件订单拆解记录", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody OrderIronRecord entity) {
        return toAjax(orderIronRecordService.insert(entity));
    }

    /**
     * 修改铁附件订单拆解记录
     */
    @PreAuthorize("@ss.hasPermi('develop:OrderIronRecord:edit')")
    @Log(title = "铁附件订单拆解记录", businessType = BusinessType.UPDATE)
    @PutMapping("/edit")
    public AjaxResult edit(@RequestBody OrderIronRecord entity) {
        return toAjax(orderIronRecordService.update(entity));
    }

    /**
     * 删除铁附件订单拆解记录
     */
    @PreAuthorize("@ss.hasPermi('develop:OrderIronRecord:remove')")
    @Log(title = "铁附件订单拆解记录", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids) {
        return toAjax(orderIronRecordService.deleteByIds(ids));
    }


//

    /**
     * 导出网格事件信息列表
     */
    @Log(title = "导出网格事件信息列表", businessType = BusinessType.EXPORT)
    @GetMapping("/exportDetailList")
    public void exportDetailList(HttpServletRequest request, HttpServletResponse response, OrderIronRecord entity) {



        orderIronRecordService.exportDetailList(request,response,entity);
    }




}
